package com.bs.sc.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@SuppressWarnings("deprecation")
@Configuration
public class ResourceConfigAdapter extends WebMvcConfigurerAdapter {

	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		// 获取文件的真实路径 work_project代表项目工程名 需要更改
		String path = System.getProperty("user.dir") + "\\src\\main\\resources\\static\\upload\\";
		System.out.println("===============真实路径：" + path);
		registry.addResourceHandler("/img/**").addResourceLocations("file:" + path);
		super.addResourceHandlers(registry);
	}
}